import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
import seaborn as sns
import re
import jieba.posseg as psg


import warnings
warnings.filterwarnings("ignore")

# 读取三个CSV文件
reviews1 = pd.read_csv('mydata1.csv', encoding='utf-8')
reviews2 = pd.read_csv('mydata2.csv', encoding='utf-8')
reviews3 = pd.read_csv('mydata3.csv', encoding='utf-8')

# 使用concat函数将它们连接起来
all_reviews = pd.concat([reviews1, reviews2, reviews3], ignore_index=True)
my_columns = ['机型','类别','描述']
all_reviews = all_reviews[my_columns]

s_models = all_reviews[all_reviews['机型'].str.startswith('S')]
x_models = all_reviews[all_reviews['机型'].str.startswith('X')]
t_models = all_reviews[all_reviews['机型'].str.startswith('T')]
y_models = all_reviews[all_reviews['机型'].str.startswith('Y')]
z_models = all_reviews[all_reviews['机型'].str.startswith('i')]
print(y_models.shape)
y_models.to_csv('y_type.csv', index=False, encoding='utf-8')
#all_reviews.to_csv('mydata.csv', index=False, encoding='utf-8')
# 打印合并后的数据框的形状和前几行
print(all_reviews.shape)
print(all_reviews.columns)
